<#if (UPDATE_ID_FIELD??)>
SELECT `D`.`${dataPrimaryKeyName}` AS "UPDATE_PRIMARY_KEY"
, CONCAT(:UPDATE_ID_FIELD, ',' ,`D`.`${dataIdFieldName}`) AS "UPDATE_ID_FIELD"
, CONCAT(:UPDATE_CODE_FIELD, ',' ,`D`.`${dataCodeFieldName}`) AS "UPDATE_CODE_FIELD"
, CONCAT(:UPDATE_NAME_FIELD, ',' ,`D`.`${dataNameFieldName}`) AS "UPDATE_NAME_FIELD"
FROM `${dataTableName}` AS `D`
WHERE `D`.`${dataParentPrimaryKeyName}` = :UPDATE_PRIMARY_KEY
<#else>
SELECT `D`.`${dataPrimaryKeyName}` AS "UPDATE_PRIMARY_KEY"
, `D`.`${dataIdFieldName}` AS "UPDATE_ID_FIELD"
, `D`.`${dataCodeFieldName}` AS "UPDATE_CODE_FIELD"
, `D`.`${dataNameFieldName}` AS "UPDATE_NAME_FIELD"
FROM `${dataTableName}` AS `D`
WHERE NOT EXISTS (SELECT 1 FROM `${dataTableName}` AS `E` WHERE `E`.`${dataPrimaryKeyName}` = `D`.`${dataParentPrimaryKeyName}`)
OR (`D`.`${dataParentPrimaryKeyName}` IS NULL OR `D`.`${dataParentPrimaryKeyName}` = '')
</#if>
